package it.mvc.test;
import it.mvc.layoutmanager.DynamicGridLayout;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.LayoutManager;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JCheckBox;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;


public class FrameWithLayoutManager extends JFrame {

	private JPanel contentPane;
	private JPanel DynamicContainer;
	private JCheckBox chckbxEditMode;
	private JPanel c1;
	private JPanel c2;
	private JPanel c3;
	private DynamicGridLayout dinamicLayout=new DynamicGridLayout();
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					FrameWithLayoutManager frame = new FrameWithLayoutManager();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public FrameWithLayoutManager() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.SOUTH);
		
		JLabel caption=new JLabel();
		caption.setText("Drag and resize");
		panel.add(caption);
		
		DynamicContainer = new JPanel();
		contentPane.add(DynamicContainer, BorderLayout.CENTER);
		DynamicContainer.setLayout(dinamicLayout);
		
		c1 = new JPanel();
		c1.setBackground(Color.GRAY);
		c1.setBounds(51, 40, 90, 63);
		DynamicContainer.add(c1);
		
		c2 = new JPanel();
		c2.setBackground(Color.YELLOW);
		c2.setBounds(223, 40, 125, 91);
		DynamicContainer.add(c2);
		
		c3 = new JPanel();
		c3.setBackground(Color.ORANGE);
		c3.setBounds(74, 144, 163, 49);
		DynamicContainer.add(c3);
	}
	

	protected void updateMode() {
		boolean value=chckbxEditMode.isSelected();
	}
}
